#include "opecv_img_save.h"
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace std;
using namespace cv;


void doOpencvImgSave()
{
	Mat img = imread("test.jpg");

	vector<int> compression_params;
#if 1	
	compression_params.push_back(CV_IMWRITE_JPEG_QUALITY);  //选择jpeg
	compression_params.push_back(100); //在这个填入你要的图片质量
	imwrite("result.jpg", img, compression_params);
#else	
	compression_params.push_back(CV_IMWRITE_PNG_COMPRESSION); //PNG格式图片的压缩级别  
	compression_params.push_back(9);  //这里设置保存的图像质量级别
	imwrite("result.png", img,compression_params);
#endif	
}

